package com.bs.bszhsq.exception;

import com.bs.bszhsq.utils.R;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalExceptionHandler {
    //全局异常处理器
@ExceptionHandler(ServiceException.class)
@ResponseBody
public R handler(ServiceException serviceException){
    return R.error(serviceException.getMessage());
}
}
